<?php 
namespace app\dashboard\validate; 

use think\Validate;

class Base extends Validate
{
	protected function strtrim($value,$rule,$data=[]){
		$param[$rule] = trim(htmlspecialchars($value));
        return true;
    }

	protected function intconvert($value,$rule,$data=[]){
		$param[$rule] = intval($value);
        return true;
    }

	protected function floatconvert($value,$rule,$data=[]){
		$param[$rule] = floatval($value);
        return true;
    }

    protected function check_contact_number($value,$rule,$data=[]) {
        if (!preg_match('/^0[0-9]{2,3}-?\d{7,8}$/', $value)) {
            if (!preg_match('/^[(86)|0]?(1\d{10})$/', $value)) {
                return false;
            }
        }
        return true;
    }
}
 ?>
